set scheme stcolor

use ../Metadata/tess_analysisdata.dta, clear

drop if hyp_nodiff == 1 // no-difference hypothesis
drop if non_treatment_test == 1 // non-experiment
drop if twop >= . 

twoway ///
	(histogram twop if twop < .05, ///
	start(0) width(.005) percent ///
	lcolor(stc1%60) fcolor(stc1%40) colordiscrete) ///
	, ///
	title("{it:p} < .05", size(5)) ///
	xlabel(, labsize(4.5) nogrid) ///
	ylabel(, labsize(4.5) nogrid) ///
	xtitle(, size(4.5)) ytitle(, size(4.5)) ///
	xsize(2) ysize(3)
	
	graph export ../Results/Figure3_left.tif, replace

twoway ///
	(histogram twop if twop > .05, ///
	start(.05) width(.05) percent ///
	lcolor(stc2%60) fcolor(stc2%40) colordiscrete) ///
	, ///
	yline(5.26, lcolor(cranberry) lstyle(foreground)) ///
	xlabel(.05 .2(.2)1, labsize(4.5) nogrid) ///
	ylabel(, labsize(4.5) nogrid) ///
	title("{it:p} > .05", size(5)) ///	
	xtitle(, size(4.5)) ytitle(, size(4.5)) ///	
	xsize(2) ysize(3)

	graph export ../Results/Figure3_right.tif, replace

/* 
NOTE added on 07-28-2025:

This note and content below was added for reference after review from Phil Jones. 

*/

* Y-line is the mean of the uniform distribution with min value .05 and max 1. 

	* generate probability distribution depicted in right panel
	cap drop xaxis yaxis
	twoway__histogram_gen twop if twop>.05, percent start(.05) width(.05) gen(yaxis xaxis)
	
	* mean of y-values in this distribution
	sum yaxis

* Sample size of each panel

	qui sum twop if twop<.05 
	di "sample size of left panel =  `r(N)'"

	qui sum twop if twop>.05
	di "sample size of right panel =  `r(N)' "
